﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Smith.ImageConverter
{
    public class WiseResize : BaseResize, IResize
    {
        public WiseResize(int longSideLen)
        {
            LongSideLength = longSideLen;
        }

        protected override Size GetNewSize(int width, int height)
        {
            if (width >= height)
                return new Size(
                    LongSideLength,
                    Convert.ToInt32((float)height * (float)LongSideLength / (float)width));
            else
                return new Size(
                    Convert.ToInt32((float)width * (float)LongSideLength / (float)height),
                    LongSideLength);
        }

        public int LongSideLength { get; private set; }
    }
}
